
module.exports = app => {
  const mongoose = app.mongoose
  
  const DevicesSchema = new mongoose.Schema({
    name: { type: String, unique: true, required: true },
    deviceid: { type: String, required: true , unique: true,},
    user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
    city: { type: String },
    telecom: { type: String },

  }, { timestamps: true })

  DevicesSchema.methods.toString = function () {
    return this.name 
  }

  return mongoose.model('Devices', DevicesSchema)
}
